#include "tracklist.h"

TrackList::TrackList(QWidget *parent):QListWidget(parent)
{
    m_emph = 0;
}

TrackList::~TrackList()
{

}

void TrackList::slotAdded(Song* song, int pos){
    Track *track = new Track(song, this);
    insertItem(pos, track);
    m_tracks.insert(pos, track);
}

void TrackList::slotPlaying(int i){
    if(m_emph){
        m_emph->emph(false);
    }

    if(i>=0 && i<m_tracks.size()){
        Track *t = m_tracks[i];
        t->emph(true);
        m_emph = t;
    }
}
